package com.ctsi.system.domain;

import com.ctsi.commons.util.UtilValidate;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 系统菜单
 *
 * @author zhangjw
 * @description 系统菜单
 * @created Fri May 04 14:39:10 CST 2018
 */
public class SysMenus implements Serializable {

    /**
     * 默认根节点
     */
    public static final Long ROOT = 1L;
    /**
     * 默认菜单类型
     */
    public static final String DEFAULT_MENU_TYPE = "default";

    /**
     * id
     */
    private Long id;
    /**
     * 标题
     */
    private String label;
    /**
     * URL
     */
    private String href;
    /**
     * icon
     */
    private String icon;
    /**
     * 菜单权限
     */
    private String permissionId;
    /**
     * 菜单权限
     */
    private Integer keepAlive;
    /**
     * 描述
     */
    private String description;
    /**
     * parentId
     */
    private Long parentId;
    /**
     * 菜单类型
     */
    private String menuType;
    /**
     * 顺序号
     */
    private Integer orderNum;

    /**
     * 是否是叶子节点
     */
    private Integer leaf;

    private List<SysMenus> children = new ArrayList<>();

    public SysMenus() {
    }

    public SysMenus(Long id) {
        this.id = id;
    }

    /**
     * 获得 id
     *
     * @return this.id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * 设置 id
     *
     * @param id
     */
    public void setId(Long id) {
        this.id = id;
    }

    public Integer getLeaf() {
        if (UtilValidate.isEmpty(this.children)) {
            return 1;
        } else {
            return 0;
        }
    }

    public void setLeaf(Integer leaf) {
        this.leaf = leaf;
    }

    /**
     * 获得 标题
     *
     * @return this.label
     */
    public String getLabel() {
        return this.label;
    }

    /**
     * 设置 标题
     *
     * @param label
     */
    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * 获得 URL
     *
     * @return this.href
     */
    public String getHref() {
        return this.href;
    }

    /**
     * 设置 URL
     *
     * @param href
     */
    public void setHref(String href) {
        this.href = href;
    }

    /**
     * 获得 icon
     *
     * @return this.icon
     */
    public String getIcon() {
        return this.icon;
    }

    /**
     * 设置 icon
     *
     * @param icon
     */
    public void setIcon(String icon) {
        this.icon = icon;
    }

    /**
     * 获得 菜单权限
     *
     * @return this.permissionId
     */
    public String getPermissionId() {
        return this.permissionId;
    }

    /**
     * 设置 菜单权限
     *
     * @param permissionId
     */
    public void setPermissionId(String permissionId) {
        this.permissionId = permissionId;
    }

    /**
     * 获得 菜单权限
     *
     * @return this.keepAlive
     */
    public Integer getKeepAlive() {
        return this.keepAlive;
    }

    /**
     * 设置 菜单权限
     *
     * @param keepAlive
     */
    public void setKeepAlive(Integer keepAlive) {
        this.keepAlive = keepAlive;
    }

    /**
     * 获得 描述
     *
     * @return this.description
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * 设置 描述
     *
     * @param description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * 获得 parentId
     *
     * @return this.parentId
     */
    public Long getParentId() {
        return this.parentId;
    }

    /**
     * 设置 parentId
     *
     * @param parentId
     */
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    /**
     * 获得 菜单类型
     *
     * @return this.menuType
     */
    public String getMenuType() {
        return this.menuType;
    }

    /**
     * 设置 菜单类型
     *
     * @param menuType
     */
    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    /**
     * 获得 顺序号
     *
     * @return this.orderNum
     */
    public Integer getOrderNum() {
        return this.orderNum;
    }

    /**
     * 设置 顺序号
     *
     * @param orderNum
     */
    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }


    public List<SysMenus> getChildren() {
        return children;
    }

    public void setChildren(List<SysMenus> children) {
        this.children = children;
    }
}
